<extend name="Public/base" />

<block name="body">
    <form >
        <!-- 标题栏 -->
        <div class="main-title">
            <h2 style="">退单管理</h2>
        </div>
        
        <div class="cf">
            <!-- 高级搜索 -->
                <!--<input type="submit" value="批量导出" class="confirm btn btn-default">-->
<!--                <a href="{:U('Order/push')}" class="btn confirm ajax-get btn-default">上推数据</a>
                <a href="{:U('Order/pull')}" class="btn confirm ajax-get btn-default">下拉数据</a>-->
            <div class="search-form fr cf" >
                <div class="sleft" style="">
                    <input type="text" name="b_date" class="text input-large time" value="{:I('b_date')}" placeholder="请选择开始时间"   style="height: 30px;width:160px" />
                </div>
                <div class="sleft" style="">
                    <input type="text" name="e_date" class="text input-large time" value="{:I('e_date')}" placeholder="请选择结束时间"   style="height: 30px;width:160px" />
                </div>
<!--                <div class="sleft">
                    <select name="aid" id="aid" class="search-input" style="height: 30px;width:160px">
                        <option value="">所有分区订单</option>
                        <option value="0">未识别分区订单</option>
                        <volist name="data.areaList" id="vo">
                            <if condition="($vo.id == $_aid)">
                                <option value="{$vo.id}" selected="selected">{$vo.areaName}</option>
                                <else/>
                                <option value="{$vo.id}">{$vo.areaName}</option>
                            </if>
                        </volist>
                    </select>
                </div>-->
                <div class="sleft">
                    <select name="status" id="status" class="search-input" style="height: 30px;width:160px">
                        <option value="">所有状态订单</option>
                         <option value="1000" {$_status=="1000"?'selected':''}>已申请，未受理</option>
                        <option value="2000" {$_status=="2000"?'selected':''}>已受理，未成功</option>
                        <option value="3000" {$_status=="3000"?'selected':''}>退单成功</option>
                        <option value="4000" {$_status=="4000"?'selected':''}>退单取消</option>     
                      
                    </select>
                </div>
                <div class="sleft">
                    <input type="text" name="id" class="search-input" value="{:I('id')}"  placeholder="订单编号查询订单" style="height: 30px;width:150px">
                    <a class="sch-btn" href="javascript:;" id="search" url="{:U('Reject/reject')}"><i class="btn-search" style="width: 25px;margin-top: 0px;" ><img src="__PUBLIC__/Admin/images/search-icon.png" style="width: 100%;"></i></a>
                </div>
            </div>
           
        </div>
       
        <!-- 数据列表 -->

        <div class="data-table table-striped">

            <table class="table table-hover">
                <thead>
                    <tr>
                        <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>                
                        <th style="min-width: 50px">退换单编号</th>

                        <th style="min-width: 120px;">状态</th>
                        <th style="width: 100px;">申请人</th>
                        <th style="min-width:80px;">联系电话</th>
                        <th width="400">收货地址</th>
                        <th width="200">申请时间</th>
                        <th style="width: 100px;">操作</th>
                    </tr>
                </thead>
                <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr  valign="top">
                            <td><input class="ids" type="checkbox" name="oid[]" value="{$vo.orderid}" /></td>
                            <td>{$vo.orderid} </td>
                            <td>{$vo.status_text} </td>	
                            <td>{$vo.user_name} </td>
                            <td>{$vo.user_tel} </td>
                            <td style="max-width: 150px;">{$vo.user_addr} 
                            <br/><span style="color: red;">{$vo.describe}</span>
                            </td>
                            <td>{$vo.create_time|time_format} </td>
                           
                            <td style="min-width: 280px;">
                                <a href="{:U('Reject/Rejectdetails')}&orderid={$vo['orderid']}" class="btn btn-default">明细</a>
                            
                            <if condition="($vo.status eq 1000)">
                                <a href="{:U('Reject/ajaxRejectTaken')}&orderid={$vo['orderid']}" class="btn btn-default ajax-get confirm" style="background:#428BCA;color:#FFF;font-weight: 700;">点击受理</a>
                            <elseif condition="($vo.status eq 2000)"/>
                                 <a href="{:U('Reject/ajaxRejectSuccess')}&orderid={$vo['orderid']}" class="btn btn-default ajax-get confirm" style="background:#D95252;color:#FFF;font-weight: 700;">点击标记成功</a>
                            <elseif condition="($vo.status eq 3000)"/>
                                 <a  class="btn btn-default " style="background:#428BCA;color:#FFF;font-weight: 700;">退换成功</a>
                            <elseif condition="($vo.status eq 4000)"/>
 
                            </if>
                            <if condition="($vo.status eq 4000)">
                              
                             <elseif condition="($vo.status eq 3000)"/>
                             <else />
                             <a href="{:U('Reject/ajaxRejectCancel')}&orderid={$vo['orderid']}" class="btn btn-default ajax-get confirm" style="background:#F0AD4E;color:#FFF;font-weight: 700;">取消退单</a>
                           </if>
                            </td>
<!--                                 <if condition="($vo.id == $_aid)">
                                <option value="{$vo.id}" selected="selected">{$vo.areaName}</option>
                                <else/>
                                <option value="{$vo.id}">{$vo.areaName}</option>-->
                            <!--</if>-->
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="12" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </table>
        </div>
        <div class="page">
            {$_page}
        </div>
    </form>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');

            var query = $('.search-form').find('input').serialize();
            var queryselect = $('.search-form').find('select').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            queryselect = queryselect.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {
                url += '&' + query;
                url += '&' + queryselect;
            } else {
                url += '?' + query;
                url += '?' + queryselect;
            }

            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('Reject/reject')}');

        $(function () {
            $('.time').datetimepicker({
                //format: 'yyyy-mm-dd hh:ii',
                format: 'yyyy-mm-dd hh:ii:ss',
                language: "zh-CN",
                minView: 2,
                autoclose: true
            });
        });
    </script>
</block>
